<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page import="org.springframework.security.core.context.SecurityContextHolder"%>
<%@ page import="java.util.Collection"%>
<%
Collection auth = SecurityContextHolder.getContext().getAuthentication().getAuthorities();
%>
<!DOCTYPE html> 
<html> 
	<head> 
	<title>CST</title> 
	<meta name="viewport" content="width=device-width, initial-scale=1"> 
	<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0-beta.1/jquery.mobile-1.2.0-beta.1.min.css" />
	<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
	<script src="http://code.jquery.com/mobile/1.2.0-beta.1/jquery.mobile-1.2.0-beta.1.min.js"></script>
	</head>
	<body> 
<div data-role="page">
	<div data-role="header">
		<h1>Home</h1>
	</div><!-- /header -->
	<div data-role="content">	
			<a href="addMatchData" data-role="button" data-ajax="false">Registra Partita</a>
			<a href="searchMatch" data-role="button" data-ajax="false">Ricerca Partite</a>
			<a href="userProfile" data-role="button" data-ajax="false">Profilo Utente</a>
			<% 
			if(auth.toString().contains("ROLE_ADMIN")){
				%>
				<a href="manageUsers" data-role="button" data-ajax="false">Gestione Utenti</a>
				<%
			}
			else{
				%>
					<input type="button" disabled value="Gestione Utenti" ></input>
				<%
			}
			%>
			<a href="matchGroupStat" data-role="button" data-transition="slidefade">Classifica Squadre</a>
			<a href="matchUserStat" data-role="button" data-transition="slidefade">Classifica Giocatori</a>
			<a href="about" data-role="button" data-transition="slidefade">Info</a>
			<a href="j_spring_security_logout" data-role="button" data-ajax="false">Esci</a>
	</div><!-- /content -->
</div><!-- /page -->
</body>
</html>